import Vue from 'vue'
import Vuex from 'vuex'

//挂载Vuex
Vue.use(Vuex)

//创建VueX对象
const store = new Vuex.Store({
    state: {
        user:{},
        //派车车辆选择
       
        //派车驾驶员选择
        sendList:[
          {
            carList:{
              
            },
            driverList:{
              
            }
          }
        ],
       
    },

    mutations:{
        setUser(state,data){
            state.user=data.data
        },
        removeUser(state){
            state.user={}
        },
        setSendList(state,data){
            console.log(data.data)
          state.sendList=data.data
        },
        addSendList(state){
            let list=state.sendList
            list.push({
                carList:{
                  
                },
                driverList:{
                  
                }
            })
            state.sendList=list
        },
        deteleSendList(state,index){
            let list=state.sendList;
             list.splice(index,1)
            state.sendList=list
        },
        removeSendList(state){
            state.sendList=[ {
                carList:{
                  
                },
                driverList:{
                   
                }
              }]
        }

    }
})

export default store